<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>处理管理员登录页</title>
</head>
<body>

    <?php 

    require_once('./system/dbConn.php');
    connect();?>
    <?php

    $username=$_POST["username"];
    $password=$_POST["password"];
    $sql="select * from users where uname='$username' and password=md5('$password')";
    $result=mysql_query("$sql");
    $num=mysql_num_rows($result);
    if ($num>0) {
        $row=mysql_fetch_assoc($result);
    	session_start();//启动会话
    	$_SESSION["username"]=$username;
        if (isset($_POST["vid"])) {
            $vid=$_POST["vid"];
            echo "login seccuss";
        header("location:show.php?vid=$vid");
        }
        //数据存入session
        else{
    	echo "login seccuss";
    	header("location:index.php");}
    }
    else{
        if (isset($_POST["vid"])) {
            $vid=$_POST["vid"];
            echo "失败";
        header("location:show.php?vid=$vid");
        }
        else{
    	echo "页面3秒后跳转";
    	header("refresh:3,url='index.php'");}
    }
    //echo "$result";
     ?>

</body>
</html>